package com.imooc.portal.web;

import com.imooc.business.processor.DefaultRequestProcessor;
import lombok.Setter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;
import java.util.List;

/**
 * @Author Tim
 * @Description:
 * @Version 1.0
 */
@RequestMapping("/data-center/schedule")
@RestController
public class ScheduleController {
    @Setter(onMethod_ = @Autowired)
    private DefaultRequestProcessor defaultRequestProcessor;

    @PostMapping("/trigger")
    public Boolean scheulde(@RequestParam(value = "groupIds") List<String> groupIds,
                            String businessId, Date requestDate) {
        defaultRequestProcessor.process(businessId, groupIds, requestDate);
        return true;
    }
}
